import java.io.IOException;
import java.net.SocketException;
import java.util.HashMap;
import java.util.Map;

public class DictService extends UdpService{
    private Map<String,String> dict=new HashMap<String,String>();
    public DictService(int port) throws SocketException {
        super(port);
        dict.put("cat","猫");
        dict.put("dog","狗");
        dict.put("duck","鸭子");
        dict.put("fish","鱼");
    }

    @Override
    public String process(String request) {
        return dict.getOrDefault(request,"未知单词");
    }

    public static void main(String[] args) throws IOException {
        DictService servicer=new DictService(9090);
        servicer.start();
    }
}
